<template>
  <div style="width:200px;height:100px;backgroundColor:springgreen">
    <h2>BA组件</h2>
    <div>{{msg}}</div>
  </div>
</template>

<script>
import bus from '@/bus'
export default {
  data(){
    return{
      msg:''
    }
  },
  methods:{
    getEventBusMsg(arg){
        console.log('我是BA中的arg',arg);
        this.msg=arg
    }
  },
  //当页面加载完毕之后会被调用
  mounted(){
     //$on中是用来接收信息的，参数说明：参数1：标识,参数：处理函数
     bus.$on('make',this.getEventBusMsg)
  },
  //当组件销毁之前调用
  beforeDestroy(){
    bus.$off('make',this.getEventBusMsg)
  }
}
</script>

<style>

</style>